package com.demo.spring.aware;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.stereotype.Component;

@Component
public class MyBeanNameAware implements BeanNameAware {

	private String id;
	
	@Override
	public void setBeanName(String beanName) {
		//ID保存BeanName的值
		System.out.println("set beanName: " + beanName);
        id = beanName;
	}

	public String getId() {
		return id;
	}

}
